/*
 * Copyright (C) 2014 mikael
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package bn.ctmc.matrix;
import dat.Enumerable;
import bn.ctmc.SubstModel;

/**
 *
 * @author mikael
 */
public class Dayhoff extends SubstModel {
    // Dayhoff model of amino acid evolution
    // Dayhoff, M. O., R. V. Eck, and C. M. Park. 1972. A model of evolutionary change in proteins. Pp. 89–99 in M. O. Dayhoff, ed., Atlas of Protein Sequence and Structure Vol. 5. National Biomedical Research Foundation, Washington, D.C.
    // The matrix below uses the improvements of 
    // Kosiol, C., and Goldman, N. 2005. Different versions of the Dayhoff rate matrix. Molecular Biology and Evolution 22:193-199.
    
    public static Character[] S = {'A','R','N','D','C','Q','E','G','H','I','L','K','M','F','P','S','T','W','Y','V'};
    
    public static double[] F = {
       //A         R         N         D         C   	 Q         E         G         H         I  	   L         K         M         F         P   	     S         T         W         Y         V
      0.087127, 0.040904, 0.040432, 0.046872, 0.033474, 0.038255, 0.049530, 0.088612, 0.033619, 0.036886, 0.085357, 0.080481, 0.014753, 0.039772, 0.050680, 0.069577, 0.058542, 0.010494, 0.029916, 0.064718};
    
    public static double[][] Q = {
       //A         R         N         D         C   	 Q         E         G         H         I  	   L         K         M         F         P   	     S         T         W         Y         V
/*A*/ {0.000000, 0.267828, 0.984474, 1.199805, 0.360016, 0.887753, 1.961167, 2.386111, 0.228116, 0.653416, 0.406431, 0.258635, 0.717840, 0.183641, 2.485920, 4.051870, 3.680365, 0.000000, 0.244139, 2.059564},
/*R*/ {0.000000, 0.000000, 0.327059, 0.000000, 0.232374, 2.439939, 0.000000, 0.087791, 2.383148, 0.632629, 0.154924, 4.610124, 0.896321, 0.136906, 1.028313, 1.531590, 0.265745, 2.001375, 0.078012, 0.240368},
/*N*/ {0.000000, 0.000000, 0.000000, 8.931515, 0.000000, 1.028509, 1.493409, 1.385352, 5.290024, 0.768024, 0.341113, 3.148371, 0.000000, 0.138503, 0.419244, 4.885892, 2.271697, 0.224968, 0.946940, 0.158067},
/*D*/ {0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.348551,11.388659, 1.240981, 0.868241, 0.239248, 0.000000, 0.716913, 0.000000, 0.000000, 0.133940, 0.956097, 0.660930, 0.000000, 0.000000, 0.178316},
/*C*/ {0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.107278, 0.282729, 0.438074, 0.000000, 0.000000, 0.000000, 0.000000, 0.187550, 1.598356, 0.162366, 0.000000, 0.953164, 0.484678},
/*Q*/ {0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 7.086022, 0.281581, 6.011613, 0.180393, 0.730772, 1.519078, 1.127499, 0.000000, 1.526188, 0.561828, 0.525651, 0.000000, 0.000000, 0.346983},
/*E*/ {0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.811907, 0.439469, 0.609526, 0.112880, 0.830078, 0.304803, 0.000000, 0.507003, 0.793999, 0.340156, 0.000000, 0.214717, 0.367250},
/*G*/ {0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.106802, 0.000000, 0.071514, 0.267683, 0.170372, 0.153478, 0.347153, 2.322243, 0.306662, 0.000000, 0.000000, 0.538165},
/*H*/ {0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.076981, 0.443504, 0.270475, 0.000000, 0.475927, 0.933709, 0.353643, 0.226333, 0.270564, 1.265400, 0.438715},
/*I*/ {0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 2.556685, 0.460857, 3.332732, 1.951951, 0.119152, 0.247955, 1.900739, 0.000000, 0.374834, 8.810038},
/*L*/ {0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.180629, 5.230115, 1.565160, 0.316258, 0.171432, 0.331090, 0.461776, 0.286572, 1.745156},
/*K*/ {0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 2.411739, 0.000000, 0.335419, 0.954557, 1.350599, 0.000000, 0.132142, 0.103850},
/*M*/ {0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.921860, 0.170205, 0.619951, 1.031534, 0.000000, 0.000000, 2.565955},
/*F*/ {0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.110506, 0.459901, 0.136655, 0.762354, 6.952629, 0.123606},
/*P*/ {0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 2.427202, 0.782857, 0.000000, 0.000000, 0.485026},
/*S*/ {0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 5.436674, 0.740819, 0.336289, 0.303836},
/*T*/ {0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.417839, 1.561997},
/*W*/ {0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.608070, 0.000000},
/*Y*/ {0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.279379},
/*V*/ {0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000}};

    public Dayhoff() {
        super(F, Q, new Enumerable(S));
    }

    public String getName() {
        return "Dayhoff";
    }
}
